Untitled9.ipynb
No Headings
The table of contents shows headings in notebooks and supported files.
- File
- Edit
- View
- Run
- Kernel
- Settings
- Help
Kernel status: Idle
[1]:
import pandas as pd
data = {
'Name': ['Alice', 'Bob', 'Charlie', 'David', 'Eva'],
'Age': [24, 30, 22, 35, 28],
'Salary': [50000, 60000, 55000, 70000, 65000]
}
df = pd.DataFrame(data)
print("First 2 rows of the DataFrame:")
print(df.head(2))
df['Bonus'] = df['Salary'] * 0.10
print("\nDataFrame after adding Bonus column:")
print(df)
average_salary = df['Salary'].mean()
print("\nAverage Salary of employees:", average_salary)
older_employees = df[df['Age'] > 25]
print("\nEmployees older than 25:")
print(older_employees)
First 2 rows of the DataFrame:
Name Age Salary
0 Alice 24 50000
1 Bob 30 60000
DataFrame after adding Bonus column:
Name Age Salary Bonus
0 Alice 24 50000 5000.0
1 Bob 30 60000 6000.0
2 Charlie 22 55000 5500.0
3 David 35 70000 7000.0
4 Eva 28 65000 6500.0
Average Salary of employees: 60000.0
Employees older than 25:
Name Age Salary Bonus
1 Bob 30 60000 6000.0
3 David 35 70000 7000.0
4 Eva 28 65000 6500.0
[ ]:
Common Tools
No metadata.
Advanced Tools
No metadata.
Anaconda Assistant
AI-powered coding, insights and debugging in your notebooks.
To enable the following extensions, create an account or sign in.
- Anaconda Assistant4.1.0
- Coming soon!
- Data Catalogs
- Panel Deployments
- Sharing
Already have an account? Sign In
For more information, read our Anaconda Assistant documentation.
![Python [conda env:base] *](./day6_files/logo-64x64.png)